home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / texinfo / info / info-utils.h < prev    next >
C/C++ Source or Header  |  1994-01-28  |  6KB  |  145 lines

  1. /* info-utils.h -- Exported functions and variables from info-util.c. */
  2.  
  3. /* This file is part of GNU Info, a program for reading online documentation
  4.    stored in Info format.
  5.  
  6.    Copyright (C) 1993 Free Software Foundation, Inc.
  7.  
  8.    This program is free software; you can redistribute it and/or modify
  9.    it under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2, or (at your option)
  11.    any later version.
  12.  
  13.    This program is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    GNU General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with this program; if not, write to the Free Software
  20.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.    Written by Brian Fox (bfox@ai.mit.edu). */
  23.  
  24. #if !defined (_INFO_UTILS_H_)
  25. #define _INFO_UTILS_H_
  26.  
  27. #if !defined (HAVE_RINDEX)
  28. #undef index
  29. #undef rindex
  30. #define index strchr
  31. #define rindex strrchr
  32. #endif
  33.  
  34. #if !defined (HAVE_BCOPY)
  35. #undef bcopy
  36. #define bcopy(source, dest, count) memcpy(dest, source, count)
  37. #endif
  38.  
  39. #include "nodes.h"
  40. #include "window.h"
  41. #include "search.h"
  42.  
  43. /* Structure which describes a node reference, such as a menu entry or
  44.    cross reference.  Arrays of such references can be built by calling
  45.    info_menus_of_node () or info_xrefs_of_node (). */
  46. typedef struct {
  47.   char *label;        /* User Label. */
  48.   char *filename;    /* File where this node can be found. */
  49.   char *nodename;    /* Name of the node. */
  50.   int start, end;    /* Offsets within the containing node of LABEL. */
  51. } REFERENCE;
  52.  
  53. /* When non-zero, various display and input functions handle ISO Latin
  54.    character sets correctly. */
  55. extern int ISO_Latin_p;
  56.  
  57. /* Variable which holds the most recent filename parsed as a result of
  58.    calling info_parse_xxx (). */
  59. extern char *info_parsed_filename;
  60.  
  61. /* Variable which holds the most recent nodename parsed as a result of
  62.    calling info_parse_xxx (). */
  63. extern char *info_parsed_nodename;
  64.  
  65. /* Parse the filename and nodename out of STRING.  If STRING doesn't
  66.    contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
  67.    INFO_PARSED_FILENAME to NULL.  If second argument NEWLINES_OKAY is
  68.    non-zero, it says to allow the nodename specification to cross a
  69.    newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
  70. void info_parse_node ();
  71.  
  72. /* Return a NULL terminated array of REFERENCE * which represents the menu
  73.    found in NODE.  If there is no menu in NODE, just return a NULL pointer. */
  74. extern REFERENCE **info_menu_of_node ();
  75.  
  76. /* Return a NULL terminated array of REFERENCE * which represents the cross
  77.    refrences found in NODE.  If there are no cross references in NODE, just
  78.    return a NULL pointer. */
  79. extern REFERENCE **info_xrefs_of_node ();
  80.  
  81. /* Glean cross references from BINDING->buffer + BINDING->start until
  82.    BINDING->end.  Return an array of REFERENCE * that represents each
  83.    cross reference in this range. */
  84. extern REFERENCE **info_xrefs ();
  85.  
  86. /* Get the entry associated with LABEL in REFERENCES.  Return a pointer to
  87.    the reference if found, or NULL. */
  88. extern REFERENCE *info_get_labeled_reference ();
  89.  
  90. /* Glean menu entries from BINDING->buffer + BINDING->start until we
  91.    have looked at the entire contents of BINDING.  Return an array
  92.    of REFERENCE * that represents each menu item in this range. */
  93. extern REFERENCE **info_menu_items ();
  94.  
  95. /* A utility function for concatenating REFERENCE **.  Returns a new
  96.    REFERENCE ** which is the concatenation of REF1 and REF2.  The REF1
  97.    and REF2 arrays are freed, but their contents are not. */
  98. REFERENCE **info_concatenate_references ();
  99.  
  100. /* Free the data associated with REFERENCES. */
  101. extern void info_free_references ();
  102.  
  103. /* Search for sequences of whitespace or newlines in STRING, replacing
  104.    all such sequences with just a single space.  Remove whitespace from
  105.    start and end of string. */
  106. void canonicalize_whitespace ();
  107.  
  108. /* Return a pointer to a string which is the printed representation
  109.    of CHARACTER if it were printed at HPOS. */
  110. extern char *printed_representation ();
  111.  
  112. /* Return a pointer to the part of PATHNAME that simply defines the file. */
  113. extern char *filename_non_directory ();
  114.  
  115. /* Return non-zero if NODE is one especially created by Info. */
  116. extern int internal_info_node_p ();
  117.  
  118. /* Make NODE appear to be one especially created by Info, and give it NAME. */
  119. extern void name_internal_node ();
  120.  
  121. /* Return the window displaying NAME, the name of an internally created
  122.    Info window. */
  123. extern WINDOW *get_internal_info_window ();
  124.  
  125. /* Return the node addressed by LABEL in NODE (usually one of "Prev:",
  126.    "Next:", "Up:", "File:", or "Node:".  After a call to this function,
  127.    the global INFO_PARSED_NODENAME and INFO_PARSED_FILENAME contain
  128.    the information. */
  129. extern void info_parse_label (/* label, node */);
  130.  
  131. #define info_label_was_found \
  132.    (info_parsed_nodename != NULL || info_parsed_filename != NULL)
  133.  
  134. #define info_file_label_of_node(n) info_parse_label (INFO_FILE_LABEL, n)
  135. #define info_next_label_of_node(n) info_parse_label (INFO_NEXT_LABEL, n)
  136. #define info_up_label_of_node(n)   info_parse_label (INFO_UP_LABEL, n)
  137. #define info_prev_label_of_node(n) \
  138.   do { \
  139.     info_parse_label (INFO_PREV_LABEL, n); \
  140.     if (!info_label_was_found) \
  141.       info_parse_label (INFO_ALTPREV_LABEL, n); \
  142.   } while (0)
  143.  
  144. #endif /* !_INFO_UTILS_H_ */
  145.